package com.ssh;

import org.junit.Test;

public class MaxArea_11 {
	public int maxArea(int[] height) {
        int max = 0,l = 0,r = height.length-1;
        while (l < r) {
        	if (height[l] < height[r]) {
        		max = Math.max(max, height[l]*(r-l));
        		l++;
        	}else {
        		max = Math.max(max, height[r]*(r-l));
        		r--;
        	}
        }
        return max;
    }
	@Test
	public void test () {
		int[] height = {1,2,4,3};
		System.out.println(maxArea(height));
	}
	
	
}
